package cn.itfenxiang.roadlawbuddha_back.controller;

import cn.itfenxiang.roadlawbuddha_back.mapper.UserMapper;
import cn.itfenxiang.roadlawbuddha_back.pojo.User;
import cn.itfenxiang.roadlawbuddha_back.service.EmailService;
import cn.itfenxiang.roadlawbuddha_back.service.UserService;
import jakarta.annotation.Resource;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Resource
    private EmailService emailService;

    @Resource
    private UserService userService;

    @GetMapping("hello")
    public String hello(){
        return "hello world";
    }

    @GetMapping("sendmail")
    public Boolean sendEmail(){
        return emailService.send("1794913446@qq.com", "帅哥，加个微信吗？", "帅哥，我要加个微信啊，带我上王者");
    }

    @GetMapping("findUser")
    public User getUser(Integer id){
        User user = userService.findById(id);
        return user;
    }


}
